package com.zxx.pattern.decoratorPattern.decorator1;

/**
 * @author zxx on 2021/7/13
 */
public class TestDecorator1 {

    public static void main(String[] args) {
        //综合咖啡
        Beverage beverage1 = new HouseBlend();
        System.out.println(beverage1.getDescription() + " = " + beverage1.getCost());

        // 一杯低咖啡因咖啡，加两份摩卡
        Beverage beverage2 = new Espresso();
        beverage2 = new Mocha(beverage2);
        beverage2 = new Mocha(beverage2);
        //10.5 20.5 20.5
        System.out.println(beverage2.getDescription() + " = " + beverage2.getCost());

        // 一杯综合咖啡，加一份牛奶和一份摩卡
        Beverage beverage3 = new HouseBlend();
        beverage3 = new Milk(beverage3);
        beverage3 = new Mocha(beverage3);
        System.out.println(beverage3.getDescription() + " = " + beverage3.getCost());
    }

}
